<template>
  <div class="audition154">
    <code class="code">
      function trim(str) {<br />
        <span class="indient">if (str && typeof str === "string") {</span><br />
          <span class="indient2">return str.replace(/(^\s*)|(\s*)$/g, ""); //去除前后空白符</span><br />
        <span class="indient">}</span><br />
      }<br />
      // 测试<br />
      console.log('@' + trim(' he llo  ') + '--') // '@he llo--'
    </code>
  </div>
</template>

<script>
export default {
  name: 'Audition154'
}
</script>

<style>

</style>